package com.wuseguang.springcloud.dao.repository;

import com.wuseguang.springcloud.entity.Student;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface StudentRepository extends JpaRepository<Student,Integer> {


    @Query(value = "select * from student where class_id = ?1",nativeQuery = true)
    List<Student> findByClassId(Integer classId);
    @Query(value = "select s.* from student s LEFT JOIN  group_student  gs on(gs.student_id=s.id) where gs.group_id =?1",nativeQuery = true)
    List<Student> findByGroupId(Integer groupId);
}
